<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div class="nav" id="navlist"></div>
<script>
     var menulist=['首页','免费资源','课程中心','IT学院','学员故事','线上学院','技术社区'];
    var str='<ul>';
    for( var item of menulist){
        str+="<li><a href='#'>"+item+"</a></li>";
    }
    str+='</ul>';
    document.getElementsByClassName("nav")[0].innerHTML=str;

    var  arr = [1,2,3,4,2,5,6,2,7,2];
    var  index = 0,newarr = [];
    for(var i in arr){
        if(arr[i] !== 2){
            newarr[index] = arr[i];
            ++index;
        }
    }


</script>
</body>
</html>